import zcConfig from './urlConfig' // 引入开发和线上环境域名配置对象
import request from '@/utils/request' // 引入权限和axios拦截器

const localApi = zcConfig.localIp + zcConfig.localPort + zcConfig.localPath // 本地Api
const onlineApi = zcConfig.onlineIp + zcConfig.onlinePort + zcConfig.onlinePath // 线上Api
const zcApi = zcConfig.isOnline ? onlineApi : localApi

// 图片上传地址
const UploadPicUrl = zcApi + '/base/pic/upload'
// 图片上传地址
export default UploadPicUrl
// 删除图片接口
export async function DeletePic(dataInfo) {
  return request({
    url: zcApi + '/base/pic/deletepic',
    method: 'get',
    params: dataInfo
  })
}
// 登录接口
export async function loginApi(dataInfo) {
  return request({
    url: zcApi + '/base/user-info/login',
    method: 'post',
    data: dataInfo
  })
}
// 修改密码
export async function changePassword(dataInfo) {
  return request({
    url: zcApi + '/base/user-info/password',
    method: 'post',
    data: dataInfo
  })
}
/* 菜单管理 */
// 获取菜单列表
export async function getMenuQuerylist(dataInfo) {
  return request({
    url: zcApi + '/base/menu/querylist',
    method: 'get',
    params: dataInfo
  })
}
// 获取菜单信息
export async function GetMenuSingle(id) {
  return request({
    url: zcApi + '/base/menu/queryone',
    method: 'get',
    params: { id }
  })
}
// 添加或者更新菜单
export async function addOrUpdateMenu(dataInfo) {
  return request({
    url: zcApi + '/base/menu/addOrUpdate',
    method: 'post',
    data: dataInfo
  })
}
// 删除菜单
export async function DeleteMenu(id) {
  return request({
    url: zcApi + '/base/menu/delete',
    method: 'get',
    params: { id }
  })
}
/* 用户管理 */
// 用户列表
export async function GetUserPageList(dataInfo) {
  return request({
    url: zcApi + '/base/user-info/querylist',
    method: 'get',
    params: dataInfo
  })
}
// 新增用户
export async function AddUser(dataInfo) {
  return request({
    url: zcApi + '/base/user-info/add',
    method: 'post',
    data: dataInfo
  })
}
// 编辑用户
export async function UpdateUser(dataInfo) {
  return request({
    url: zcApi + '/base/user-info/update',
    method: 'post',
    data: dataInfo
  })
}
// 获取用户详情
export async function GetUserSingle(id) {
  return request({
    url: zcApi + '/base/user-info/queryone',
    method: 'get',
    params: { id }
  })
}
// 删除用户
export async function DeleteUser(id) {
  return request({
    url: zcApi + '/base/user-info/delete',
    method: 'get',
    params: { id }
  })
}
/* 角色管理 */
// 角色列表
export async function GetRoleTable(dataInfo) {
  return request({
    url: zcApi + '/base/role/querylist',
    method: 'get',
    params: dataInfo
  })
}
// 新增角色或编辑角色
export async function AddOrUpdateRole(dataInfo) {
  return request({
    url: zcApi + '/base/role/addOrUpdate',
    method: 'post',
    data: dataInfo
  })
}
// 删除角色
export async function DeleteRole(id) {
  return request({
    url: zcApi + '/base/role/delete',
    method: 'get',
    params: { id }
  })
}
// 获取单条角色信息
export async function GetRoleSingle(id) {
  return request({
    url: zcApi + '/base/role/queryone',
    method: 'get',
    params: { id }
  })
}
// 查询角色对应的菜单
export async function GetRoleMenu(roleId) {
  return request({
    url: zcApi + '/base/role-menu/queryone',
    method: 'get',
    params: { roleId }
  })
}
// 编辑角色对应菜单
export async function UpdateRoleMenu(dataInfo) {
  return request({
    url: zcApi + '/base/role-menu/addOrUpdate',
    method: 'post',
    data: dataInfo
  })
}
// 更新当前用户菜单权限
export async function UpdateUserMenu(userId) {
  return request({
    url: zcApi + '/base/role-menu/usermenu',
    method: 'get',
    params: { userId }
  })
}
/* 信息分类 */
// 信息分类列表
export async function GetPublishSortTable(dataInfo) {
  return request({
    url: zcApi + '/base/publish-sort/querylist',
    method: 'get',
    params: dataInfo
  })
}
// 单条信息分类详情
export async function GetPublishSortSingle(id) {
  return request({
    url: zcApi + '/base/publish-sort/queryOne',
    method: 'get',
    params: { id }
  })
}
// 删除信息分类
export async function DeletePublishSort(id) {
  return request({
    url: zcApi + '/base/publish-sort/delete',
    method: 'get',
    params: { id }
  })
}
// 新增编辑信息分类
export async function AddOrUpdatePublishSort(dataInfo) {
  return request({
    url: zcApi + '/base/publish-sort/saveOrUpdate',
    method: 'post',
    data: dataInfo
  })
}
/* 信息发布 */
// 信息发布列表
export async function GetPublishInfoTable(dataInfo) {
  return request({
    url: zcApi + '/base/publish-info/querylist',
    method: 'get',
    params: dataInfo
  })
}
// 获取单条信息发布详情
export async function GetPublishInfoSingle(id) {
  return request({
    url: zcApi + '/base/publish-info/queryOne',
    method: 'get',
    params: { id }
  })
}
// 删除信息分类
export async function DeletePublishInfo(id) {
  return request({
    url: zcApi + '/base/publish-info/delete',
    method: 'get',
    params: { id }
  })
}
// 新增编辑信息分类
export async function AddOrUpdatePublishInfo(dataInfo) {
  return request({
    url: zcApi + '/base/publish-info/saveOrUpdate',
    method: 'post',
    data: dataInfo
  })
}
// 合作伙伴
// 新增或更新合作伙伴
export async function AddOrUpdatePartner(dataInfo) {
  return request({
    url: zcApi + '/base/partner/addOrUpdate',
    method: 'post',
    data: dataInfo
  })
}
// 删除合作伙伴
export async function DeletePartner(id) {
  return request({
    url: zcApi + '/base/partner/delete',
    method: 'get',
    params: { id }
  })
}
// 合作伙伴列表
export async function GetPartnerTable(dataInfo) {
  return request({
    url: zcApi + '/base/partner/querylist',
    method: 'get',
    params: dataInfo
  })
}
// 获取单条合作伙伴详情
export async function GetPartnerSingle(id) {
  return request({
    url: zcApi + '/base/partner/queryone',
    method: 'get',
    params: { id }
  })
}
// 站内导航
// 新增或更新站内导航
export async function AddOrUpdateSitemap(dataInfo) {
  return request({
    url: zcApi + '/base/sitemap/addOrUpdate',
    method: 'post',
    data: dataInfo
  })
}
// 删除站内导航
export async function DeleteSitemap(id) {
  return request({
    url: zcApi + '/base/sitemap/delete',
    method: 'get',
    params: { id }
  })
}
// 合作站内导航
export async function GetSitemapTable(dataInfo) {
  return request({
    url: zcApi + '/base/sitemap/querylist',
    method: 'get',
    params: dataInfo
  })
}
// 获取单条站内导航详情
export async function GetSitemapSingle(id) {
  return request({
    url: zcApi + '/base/sitemap/queryone',
    method: 'get',
    params: { id }
  })
}
// 友情链接
// 新增或更新友情链接
export async function AddOrUpdateBlogroll(dataInfo) {
  return request({
    url: zcApi + '/base/blogroll/addOrUpdate',
    method: 'post',
    data: dataInfo
  })
}
// 删除友情链接
export async function DeleteBlogroll(id) {
  return request({
    url: zcApi + '/base/blogroll/delete',
    method: 'get',
    params: { id }
  })
}
// 合作友情链接
export async function GetBlogrollTable(dataInfo) {
  return request({
    url: zcApi + '/base/blogroll/querylist',
    method: 'get',
    params: dataInfo
  })
}
// 获取单条友情链接详情
export async function GetBlogrollSingle(id) {
  return request({
    url: zcApi + '/base/blogroll/queryone',
    method: 'get',
    params: { id }
  })
}
// 广告位管理
// 新增或更新广告位
export async function AddOrUpdateAdvertisePosi(dataInfo) {
  return request({
    url: zcApi + '/base/advertise-position/addOrUpdate',
    method: 'post',
    data: dataInfo
  })
}
// 删除广告位
export async function DeleteAdvertisePosi(id) {
  return request({
    url: zcApi + '/base/advertise-position/delete',
    method: 'get',
    params: { id }
  })
}
// 广告位列表
export async function GetAdvertisePosiTable(dataInfo) {
  return request({
    url: zcApi + '/base/advertise-position/querylist',
    method: 'get',
    params: dataInfo
  })
}
// 获取单条广告位详情
export async function GetAdvertisePosiSingle(id) {
  return request({
    url: zcApi + '/base/advertise-position/queryone',
    method: 'get',
    params: { id }
  })
}
// 广告内容管理
// 新增或更新广告内容管理
export async function AddOrUpdateAdvertiseInfo(dataInfo) {
  return request({
    url: zcApi + '/base/advertise-info/addOrUpdate',
    method: 'post',
    data: dataInfo
  })
}
// 删除广告内容管理
export async function DeleteAdvertiseInfo(id) {
  return request({
    url: zcApi + '/base/advertise-info/delete',
    method: 'get',
    params: { id }
  })
}
// 广告内容管理列表
export async function GetAdvertiseInfoTable(dataInfo) {
  return request({
    url: zcApi + '/base/advertise-info/querylist',
    method: 'get',
    params: dataInfo
  })
}
// 获取单条广告内容管理详情
export async function GetAdvertiseInfoSingle(id) {
  return request({
    url: zcApi + '/base/advertise-info/queryone',
    method: 'get',
    params: { id }
  })
}
// 日志
// 日志列表
export async function GetLogsTable(dataInfo) {
  return request({
    url: zcApi + '/base/error-log/querylist',
    method: 'get',
    params: dataInfo
  })
}
// 获取单条日志详情
export async function GetLogsSingle(logId) {
  return request({
    url: zcApi + '/base/error-log/queryone',
    method: 'get',
    params: { logId }
  })
}
// 删除日志
export async function DeleteLogs(logId) {
  return request({
    url: zcApi + '/base/error-log/delete',
    method: 'get',
    params: { logId }
  })
}
// 留言管理
// 留言列表
export async function GetMessageTable(dataInfo) {
  return request({
    url: zcApi + '/base/leave-messages/querylist',
    method: 'get',
    params: dataInfo
  })
}
// 获取单条留言详情
export async function GetMessageSingle(id) {
  return request({
    url: zcApi + '/base/leave-messages/queryOne',
    method: 'get',
    params: { id }
  })
}
// 更新留言
export async function SaveMessage(dataInfo) {
  return request({
    url: zcApi + '/base/leave-messages/saveOrUpdate',
    method: 'post',
    data: dataInfo
  })
}
// 标签库
export async function GetTagQuerylist(dataInfo) {
  return request({
    url: zcApi + '/base/tag/querylist',
    method: 'get',
    params: dataInfo
  })
}
